const nodemailer = require("nodemailer");
const emailconfig = require("../config/email");

let transporter = nodemailer.createTransport({
    service:'qq',
    auth: {
      user: emailconfig.email, // generated ethereal user
      pass: emailconfig.smtp, // generated ethereal password
    },
  });

 exports.emailSignUp  = function(email,res){
    let options = {
        from: '240046220@qq.com', // sender address
        to: email, // list of receivers
        subject: "欢迎成为wiki", // Subject line
        html: "<span>我们欢迎你来wiki聊天室</span>", // html body
      }
      transporter.sendMail(options,(err,msg)=>{
          if(err){
              res.send('邮件发送失败'+err)
          }else{
              res.send('邮件发送成功'+msg)
          }
      })
 }